﻿@model HouseAgencySite.Models.HouseInfos

@{
    Layout = "~/Areas/Admin/Views/Shared/_EditLayout.cshtml";
}


@{
    List<SelectListItem> list = HouseAgencySite.Utils.ParamHelper.GetHouseArea(Request["AreaID"], false);
    List<SelectListItem> listHuXing = HouseAgencySite.Utils.ParamHelper.HuXing(false, Request["AreaID"]);
    List<SelectListItem> listHouseType = HouseAgencySite.Utils.ParamHelper.HouseType(false, Request["AreaID"]);
    
}
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

    <table class="table table-bordered">
        <thead>
            <tr class="success">
                <th colspan="3" class="text-center xl">@ViewBag.Title</th>
            </tr>
        </thead>
        <tr>
            <td>

                <div class="editor-label">
                    @Html.LabelFor(model => model.HouseType)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.HiddenFor(model => model.Guid)
                    @Html.DropDownListFor(o => o.HouseType, listHouseType, new { @class = "form-control", style = "width:150px" })
                    @Html.ValidationMessageFor(model => model.HouseType)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Title)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Title, new { size = 50 })
                    @Html.ValidationMessageFor(model => model.Title)
                </div>
            </td>
        </tr>
       
         <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.SubTitle)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.SubTitle)
                    @Html.ValidationMessageFor(model => model.SubTitle)
                </div>
            </td>
        </tr>
         
         <tr style="display:none;">
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Latitude)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Latitude)
                    @Html.ValidationMessageFor(model => model.Latitude)
                </div>
            </td>
        </tr>
        <tr style="display:none;">
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Longitude)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Longitude)
                    @Html.ValidationMessageFor(model => model.Longitude)
                </div>
            </td>
        </tr>
       
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.ZhaiYao)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.TextAreaFor(model => model.ZhaiYao)
                    @Html.ValidationMessageFor(model => model.ZhaiYao)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Price)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Price)
                    @Html.ValidationMessageFor(model => model.Price)
                </div>
            </td>
        </tr>
        <tr>
            <td>

                <div class="editor-label">
                    @Html.LabelFor(model => model.MianJi)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.MianJi)
                    @Html.ValidationMessageFor(model => model.MianJi)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.LouCeng)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.LouCeng)
                    @Html.ValidationMessageFor(model => model.LouCeng)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.HuXing)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.DropDownListFor(o => o.HuXing, listHuXing, new { @class = "form-control", style = "width:150px" })
                    @Html.ValidationMessageFor(model => model.HuXing)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Description)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.TextAreaFor(model => model.Description)
                    @Html.ValidationMessageFor(model => model.Description)
                </div>
            </td>
        </tr>
        <tr>
            <td>

                <div class="editor-label">
                    @Html.LabelFor(model => model.AreaID)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.DropDownListFor(model => model.AreaID, list, new { @class = "form-control", style = "width:150px" })
                    @Html.ValidationMessageFor(model => model.AreaID)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Around)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.TextAreaFor(model => model.Around)
                    @Html.ValidationMessageFor(model => model.Around)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.JiaoTong)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.TextAreaFor(model => model.JiaoTong)
                    @Html.ValidationMessageFor(model => model.JiaoTong)
                </div>
            </td>
        </tr>
        <tr>
            <td>

                <div class="editor-label">
                    @Html.LabelFor(model => model.AddressDetail)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.AddressDetail)
                    @Html.ValidationMessageFor(model => model.AddressDetail)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.EstateName)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.EstateName)
                    @Html.ValidationMessageFor(model => model.EstateName)
                </div>
            </td>
        </tr>
        <tr >
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.MapUrl)
                </div>
            </td>
            <td>
                <div class="editor-field">
                    @Html.EditorFor(model => model.MapUrl)
                    @Html.ValidationMessageFor(model => model.MapUrl)
                </div>
            </td>
        </tr>
         <tr>
            <td colspan="2"><a href="http://api.map.baidu.com/lbsapi/getpoint/index.html" target="_blank">点此获取楼盘坐标</a></td>
        </tr>
        <tr>
            <td>
                <div class="editor-label">
                    @Html.LabelFor(model => model.AttachUrl)
                </div>
            </td>
            <td>
                <div class="editor-field form-inline">
                    <input type="file" id="AttachUrl" name="AttachUrl"><input type="button" id="btnUpload" value="上传图片" class="btn btn-primary" />
                    <div class="carousel-inner" id="imgpreview">
                    </div>
                </div>
            </td>
        </tr>

    </table>  <div class="text-center alert alert-info alert-dismissabl">
        <input type="button" value="保  存" class="btn btn-primary" id="btnSubmit" />
        <input type="submit" value="关  闭" class="btn btn-primary" id="btnClose" />
    </div>
}

<script type="text/javascript">

    window.onload = function () {
        var editor = CKEDITOR.replace('Description');
        CKFinder.setupCKEditor(editor, '/Controls/ckfinder/');
        var Around = CKEDITOR.replace('Around');
        CKFinder.setupCKEditor(Around, '/Controls/ckfinder/');
        var JiaoTong = CKEDITOR.replace('JiaoTong');
        CKFinder.setupCKEditor(JiaoTong, '/Controls/ckfinder/');
        var zhaiyao = CKEDITOR.replace('ZhaiYao');
        CKFinder.setupCKEditor(zhaiyao, '/Controls/ckfinder/');

    };
    $(function () {
        $("#btnUpload").click(function () {
            $('#AttachUrl').uploadify("upload");
        })
        var title = encodeURI($("#Title").val());
        $('#AttachUrl').uploadify({
            'buttonText': '请选择上传文件',
            'swf': '@Url.Content("~/Controls/uploadify/uploadify.swf")',
            'auto': false,
            'multi': true,
            'uploader': '@Url.Action("Upload", "File", new { ResourceID = Model.Guid })' + "&Description=" + title+"&ASP.NET_SesstionId=@(Session.SessionID)",
            'onUploadSuccess': function () {
                LoadImgs('@(Model.Guid)', 'imgpreview');
            }
        });
        LoadImgs('@(Model.Guid)', 'imgpreview');
    });
</script>